import aioredis
import asyncio

redis_url = "redis://localhost"


async def main():
    redis = await aioredis.create_redis_pool(redis_url)

    await redis.set('my_key', 'my_value')

    value = await redis.get('my_key')
    if value:
        print(value.decode('utf-8'))
    else:
        print("Key not found")

    redis.close()
    await redis.wait_closed()


asyncio.run(main())
